# encoding:utf-8
import requests
"""
获取百度Apitoken以调用API
"""

# client_id 为官网获取的AK， client_secret 为官网获取的SK

def get_token():
    host = 'https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=gDW4STokoLUsG7RvZ0FEjSkR&client_secret=YV9RIeTeyZfUlRjve94DBG9bMUyrQ03W'
    response = requests.get(host)
    if response:
        print(response.json())
    else:
        print("Error!")
    return response.json()['access_token']


if __name__ == '__main__':
    print(get_token())